<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport"   content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
	<meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <script src="./static/js/rem.js"></script>
    <link rel="stylesheet" href="./static/css/base.css">
    <link rel="stylesheet" href="./static/css/index.css">
    <link rel="stylesheet" href="./static/css/swiper.min.css">

    <title>Document</title>
</head>
<body>
    <div class="content">
        <!-- 头部图片 -->
        <div class="topimg">
            <div class="swiper-container" id="swiper">
                <div class="swiper-wrapper">
                <div class="swiper-slide slide1">
                    <div class="title txt">
                        <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000"></a>
                    </div>
                </div>
                <div class="swiper-slide slide2">
                    <div class="title txt">
                        <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000"></a>
                    </div>
                    <!-- <h2 class="homepage-headline txt">Series 2 新登场。</h2> -->
                </div>
                <div class="swiper-slide slide3">
                    <div class="title txt">
                        <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000"></a>
                    </div>
                    <!-- <p> 一身才华，一触即发 </p> -->
                </div>
                </div>
                <ul class="swiper-pagination autoplay"> </ul>
            </div>            
        </div>

        <!-- 菜单 -->
        <ul class="nav">
            <li>
                <a href="#">首页</a>
            </li>
            <li>
                <a href="#">健康管理师</a>
            </li>
            <li>
                <a href="#">成人高考</a>
            </li>
            <li>
                <a href="#">教师资格证</a>
            </li>
        </ul>

        <!-- banner  -->
        <div class="banner">
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
        </div>
        
        <div class="form">
            <div class="form-item">
                <div class="label short">
                    <span class="star">*</span>
                    年龄
                </div>
                <div class="radiobox" id="j_age">
                    <div class="radio-item selected" data-id="1">18-25周岁</div>
                    <div class="radio-item" data-id="2">26-40周岁</div>
                    <div class="radio-item" data-id="3">41-50周岁</div>
                    <div class="radio-item" data-id="4">其他</div>
                </div>
            </div>
            <div class="form-item">
                <div class="label short">
                    <span class="star">*</span>
                    学历
                </div>
                <div class="radiobox" id="j_xueli">
                    <div class="radio-item selected" data-id="1">高中/中专</div>
                    <div class="radio-item" data-id="2">大专</div>
                    <div class="radio-item" data-id="3">本科</div>
                    <div class="radio-item" data-id="4">其他</div>
                </div>
            </div>
            <div class="form-item">
                <div class="label short">
                    <span class="star">*</span>
                    称呼
                </div>
                <div class="iptbox">
                    <input type="text"  id="j_name" placeholder="请输入您的称呼"/>
                </div>
            </div>
            <div class="form-item">
                <div class="label short">
                    <span class="star">*</span>
                    电话
                </div>
                <div class="iptbox">
                    <input type="tel"  id="j_tel"  placeholder="请输入手机号"/>
                </div>
            </div>
            <div class="btn">
                <button type="button" onclick="handleSubmit()">立即提交</button>
            </div>
        </div>

        <!-- 底部图片 -->
        <div class="foot-ad">
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
            <a href=""><img src="https://inews.gtimg.com/newsapp_bt/0/12773095312/1000" /></a>
        </div>
        <div class="footer">
            广州文拓教育咨询有限公司
        </div>
    </div> 
    <script src="./static/js/zepto.min.js"></script>
    <script src="./static/js/swiper.min.js"></script>
    <script src="./static/js/banner.js"></script>
    <script>
        window.onload = function(){
            swiperBanner();
        }
        var lock = false;

        $('.radio-item').on('click', function() {
            $(this).addClass('selected').siblings().removeClass('selected')
        })

        //表单提交
        function handleSubmit() {
            var name = $('#j_name').val()
            var tel = $('#j_tel').val()
            var age = $('.selected', '#j_age').data('id')
            var xueli = $('.selected', '#j_xueli').data('id')
            if (lock) {
                return false
            }
            lock = true;

            if ($.trim(name).length == 0) {
                alert('请输入您的称呼')
                return false
            }
            if ($.trim(tel).length == 0) {
                alert('请输入您的电话')
                return false
            }

            $.ajax({
                type: 'POST',
                url: '/test',
                data: {
                    name: name,
                    age: age,
                    tel: tel,
                    xueli: xueli
                },
                dataType: 'json',
                success: function(data) {
                    alert("提交成功")
                    lock = false
                }
            })
        }
    </script>  
</body>
</html>
